const typeMap = {
  '1': '焊工',
  '2': '高压',
  '3': '低压',
  '4': '高处'
}

const statusMap = {
  '1': '全量',
  '2': '常备'
}

Page({
  data: {
    type: '',
    status: '',
    title: '',
    spinShow: false
  },

  onLoad: function (options) {
    const { type, status, title } = options;
    const typeName = typeMap[type] || '';
    const statusName = statusMap[status] || '';
    
    this.setData({
      type: type,
      status: status,
      title: title || `${typeName}${statusName} - 练习`
    });
    
    // 设置页面标题
    wx.setNavigationBarTitle({
      title: this.data.title
    });
  },

  // 顺序刷题
  navigateToSequence: function() {
    const { type, status } = this.data;
    console.log("type + status", type , status)
    // 跳转到顺序刷题页面，并传递type和status
    wx.navigateTo({
      url: `/pages/exercise/index?type=${type}&status=${status}`
    })
  },

  // 学分记录
  navigateToOften: function() {
    const { type, status } = this.data;
    // 跳转到学分记录页面，并传递type和status
    wx.navigateTo({
      url: `/pages/record/index?type=${type}&status=${status}&mode=often`
    })
  },

  // 模拟考试
  navigateToExam: function() {
    const { type, status } = this.data;
    // 跳转到模拟考试页面，并传递type和status
    wx.navigateTo({
      url: `/pages/exam/do/index?type=${type}`
    })
  },

  // 错题记录
  navigateToWrong: function() {
    const { type, status } = this.data;
    // 跳转到错题记录页面，并传递type和status
    wx.navigateTo({
      url: `/pages/exercise/index?type=${type}&isWrong=2`
    })
  },

  // 学分记录
  navigateToCredit: function() {
    const { type, status } = this.data;
    // 跳转到学分记录页面，并传递type和status
    wx.navigateTo({
      url: `/pages/record/index`
    })
  }
})